﻿// Shows/Hides elements
function $show(element)
{
    element.style.display = 'block';
}
function $hide(element)
{
    element.style.display = 'none';
}
// Gets select control selected text/value
function getSelectValue(element)
{
    return element.options[element.selectedIndex].value;
}
function getSelectText(element)
{
    return element.options[element.selectedIndex].text;
}

// Enables textbox watermark
function textBoxWatermark(textBox, waterMark, className)
{
    textBox.setAttribute("watermark",waterMark);
    textBox.value = waterMark;
    if(className)
    {
        textBox.className = className;
        textBox.setAttribute("watermarkClass",className);
        textBox.setAttribute("originalClass",this.className);
    }
    textBox.onblur = function(){
        var waterMark = this.getAttribute("waterMark");
        if(this.value == '' || this.value.length == 0)
        {
            this.value = waterMark;
            if(this.getAttribute("waterMarkClass"))
                this.className = this.getAttribute("waterMarkClass");
        }    
    };
    
    textBox.onfocus = function(){
        var waterMark = this.getAttribute("waterMark");
        if(this.value == waterMark)
        {
            this.value = '';      
            if(this.getAttribute("waterMarkClass"))
                this.className = this.getAttribute("originalClass");

        }   
    };
}